package com.gg.user.gguser.dao;

import com.gg.user.gguser.dataobject.GgRemarksDataobject;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface GgRemarksDaoMapper {

    @Insert("insert into gg_remarks(gg_r_count,gg_r_items_id,gg_r_user_id) values(#{count},#{itemsId},#{userId})")
    Integer add(@Param("count")String count, @Param("itemsId")String itemsId,@Param("userId")String userId); //获取用户名知否存在

    @Select("select date_format(gg_r_time, '%Y-%m-%d %H:%i:%s') as ggRTime,gg_r_count as ggRCount from gg_remarks where gg_r_user_id = #{userId} and gg_r_items_id=#{token} order by gg_r_time desc")
    List<GgRemarksDataobject> getGgRemarkAll(@Param("token")String token,@Param("userId")String userId);


}
